﻿Imports BUS
Public Class frmExportExcel : Inherits DevComponents.DotNetBar.Office2007Form

    Private m_strFilePath As String
    Public Property FilePath() As String
        Get
            Return m_strFilePath
        End Get
        Set(ByVal value As String)
            m_strFilePath = value
        End Set
    End Property

    Private Sub frmExportExcel_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        DialogResult = Windows.Forms.DialogResult.OK
    End Sub


    Public Function ExportAllTableToExcel() As DialogResult
        If New CExportExcelBUS().ExportAllTableToExcel(m_strFilePath) Then
            LabelX1.Text = "Export Thành công"
            Process.Start(m_strFilePath)
            Return DialogResult.OK
        Else
            LabelX1.Text = "Export Thất bại"
        End If
        Return DialogResult.Cancel
    End Function

    Public Function ExportTableToExcel(ByVal tablename As String) As DialogResult
        If New CExportExcelBUS().ExportTableToExcel(m_strFilePath, tablename) Then
            LabelX1.Text = "Export Thành công"
            Process.Start(m_strFilePath)
            Return DialogResult.OK
        Else
            LabelX1.Text = "Export Thất bại"
        End If
        Return DialogResult.Cancel
    End Function

End Class